#ifndef SUBLOGIC_H
#define SUBLOGIC_H

#include "OnlineList.h"
#include "wrap.h"

#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <signal.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <time.h>

#define CHAT_DATABASE "/home/lh/networkprogram/network_server/chat_record.txt"
#define USER_DATABASE "/home/lh/networkprogram/network_server/userdata.txt"


char* printTime();
void eraseStr_n(char* buf);
void printMsg(msgdata* msg);
void userinfoTodatabase(char* acc,char* pwd);
char checkUserInfo(char* acc,char* pwd);
void logon(char* acc,char* pwd,int fd);
void login(char* acc,char* pwd,int fd);
void chatone(int fd,msgdata* msg);
char chatgroup(msgdata* msg);
void saveChatRecord(char* sender,char* receiver,char* msgcontent);
void chatRecordTofile();
void acceptProcess(thFunctionArg* arg);
void ClientMsgProcess(thFunctionArg* arg);

#endif
